<template>
    <div class="container">
        <div class="btns btns-inline">
            <div class="btn" :class="{active:item.active}" v-for="item in warnTableList" :key="item.value" @click="warnBtns(item)">{{ item.label }}</div>
        </div>
        <div class="warn-content" v-if="tabIndex === 1">
            <div class="chart" style="height: 50%;">
                <Bar :chartData="chartData2" v-if="chartData2" />
            </div>
            <div class="table" style="height: 50%;">
                <el-table :data="data" height="100%" empty-text="暂无数据">
                    <el-table-column
                        v-for="(item, index) in tableHeaderList"
                        :key="index"
                        :prop="item.prop"
                        :label="item.label"
                        align="center"
                        show-overflow-tooltip
                    >
                    </el-table-column>
                </el-table>
            </div>
        </div>
        <div class="warn-content" v-if="tabIndex === 2">
            <div class="warn-content-warp">
                <div class="item" v-for="item in videoData" :key="item">
                    <div class="left"><el-icon><WarningFilled /></el-icon></div>
                    <div class="right">
                        <div class="date">{{ item.date }}</div>
                        <div class="desc">{{ item.desc }}</div>
                    </div>
                </div>
            </div>
        </div>
        <div class="warn-content" v-if="tabIndex === 3">
            <div class="warn-content-warp">
                <div class="item" v-for="item in uavData" :key="item">
                    <div class="left"><el-icon><WarningFilled /></el-icon></div>
                    <div class="right">
                        <div class="date">{{ item.date }}</div>
                        <div class="desc">{{ item.desc }}</div>
                    </div>
                </div>
            </div>
        </div>
        <div class="warn-content" v-if="tabIndex === 4 || tabIndex === 5 || tabIndex === 6">
            <div class="warn-content-report">
                <div class="item" v-for="item in reportData" :key="item.date">
                    <div class="date">
                        <span>{{ item.date }}</span>
                        <span class="line"></span>
                    </div>
                    <div class="item-content" v-for="t in item.timeList" :key="t.time">
                        <span class="line"></span>
                        <span class="time">{{ t.time }}</span>
                        <div class="item-content-warp">
                            <div class="desc">{{ t.content }}</div>
                            <div class="user">
                                <span>上报人：{{ t.user }}</span>
                                <span class="stat" :class="{stating:t.stat === 1,finish:t.stat === 2}">{{ t.statText }}</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script setup>
    import { ref, onMounted } from "vue";
    import { WarningFilled } from '@element-plus/icons-vue'
    import { hzzgzzboption } from './echartsoptions'
    import { tableHeader, table, warnTable, video, uav, report } from './dataconfig'
    import Bar from '@/components/echarts/bar.vue'
    const warnTableList = ref(warnTable)
    const chartData2 = ref(hzzgzzboption)
    const videoData = ref(video)
    const uavData = ref(uav)
    const reportData = ref(report)
    const tabIndex = ref(1);
    const tableHeaderList = ref(tableHeader)
    const data = ref(table)
    onMounted(() => {
        
    })
    const warnBtns = (item) => {
        warnTableList.value.forEach(t => {
            t.active = false
            if (t.value === item.value) {
                tabIndex.value = item.value
                t.active = true
            }
        })
    }
</script>
<style scoped lang="less">
.container {
    height: 100%;
    width: 100%;
    .btns-inline {
        display: block;
        margin: 0.5rem 0 0;
        .btn {
            display: inline-block;
            text-align: center;
            margin-right: 0.5rem;
            margin-bottom: 0.5rem;
            line-height: 1.1rem;
            background: #0B2A4A;
            width: calc(25% - 0.5rem);
            padding: 0.2rem 0;
            color: #fff;
            cursor: pointer;
            &.active {
                background: #636737;
            }
        }
    }
    .warn-content {
        height: calc(100% - 5rem);
        width:100%;
        color: #fff;
        .warn-content-warp {
            height: 100%;
            overflow: auto;
            .item {
                display: flex;
                align-items: center;
                border: 0.01rem solid #1E4D69;
                margin-bottom: 0.5rem;
                padding: 0.2rem 0.5rem;
                .left {
                    font-size: 1.6rem;
                    color: #F56C6C;
                    margin-right: 1rem;
                    background: #000;
                    width: 1.2rem;
                    display: flex;
                    justify-content: center;
                    height: 1.2rem;
                    align-items: center;
                    border-radius: 50%;
                }
                .desc {
                    color: #F56C6C;
                }
            }
        }
        .warn-content-report {
            height: 100%;
            overflow: auto;
            padding: 0 0.5rem;
            .date {
                display: flex;
                align-items: center;
                color: #18E8F5;
                flex: 1;
                margin-bottom: 0.5rem;
                position: relative;
                &::before {
                    content: "";
                    position: absolute;
                    top: 1.2rem;
                    left: 0.66rem;
                    width: 0.01rem;
                    height: 0.6rem;
                    background: #18E8F5;
                }
                .line {
                    flex: 1;
                    height: 0.01rem;
                    background: #0A6375;
                    margin-left: 0.2rem;
                }
            }
            .item-content {
                display: flex;
                flex: 1;
                margin-bottom: 0.5rem;
                .line {
                    width: 0.5rem;
                    height: 0.5rem;
                    border-radius: 50%;
                    background: #18E8F5;
                    margin: 0 0.5rem;
                    position: relative;
                    &::before {
                        content: "";
                        position: absolute;
                        top: 0.3rem;
                        left: 0.19rem;
                        width: 0.01rem;
                        height: 3.8rem;
                        background: #18E8F5;
                    }
                }
                .time {
                    margin: 0 0.5rem;
                }
                .item-content-warp {
                    flex: 1;
                    border: 0.01rem solid #18E8F5;
                    padding: 0.3rem;
                    .user {
                        display: flex;
                        justify-content: space-between;
                        margin-top: 0.3rem;
                        .stat {
                            padding: 0.1rem 0.4rem;
                            background: #EC808D;
                            font-size: 0.8rem;
                            line-height: 1.1rem;
                        }
                        .stating {
                            background: #18E8F5;
                        }
                        .finish {
                            background: #18F563;
                        }
                    }
                }
            }
        }
    }
}
</style>
<style lang="less">
.el-table {
    background-color: transparent;
    th.el-table__cell,
    tr {
        background-color: transparent;
        color: #fff;
    }
    
}
.el-table th.el-table__cell {
    background-color: #062C46;
}
.el-table--fit .el-table__inner-wrapper:before,
.el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell {
    background-color: transparent;
}
.el-table,
.el-table td.el-table__cell, .el-table th.el-table__cell.is-leaf {
    border: none;
}
// 设置行的背景颜色
.el-table tr:nth-child(even) {
//   background: #002128 !important;
  border: none !important;
}
.el-table tr:nth-child(odd) {
  background: #002128 !important;
}
</style>